﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;

namespace ELoje_web
{
    public class Global : HttpApplication
    {

        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }

        //public void Application_AuthenticateRequest(object sender, EventArgs e)
        //{
        //    //'Fires upon attempting to authenticate the use
        //    if ((HttpContext.Current.User != null))
        //    {
        //        //Usando as classes de identidade vamos obter o perfil e carregar na aplicação   
        //        if (HttpContext.Current.User.Identity.IsAuthenticated)
        //        {
        //            if (HttpContext.Current.User.Identity is FormsIdentity)
        //            {
        //                FormsIdentity fi = (FormsIdentity)HttpContext.Current.User.Identity;
        //                //obtém o ticket de autenticação
        //                FormsAuthenticationTicket fat = fi.Ticket;
        //                string[] astrPerfis = fat.UserData.Split('|');
        //                HttpContext.Current.User = new GenericPrincipal(fi, astrPerfis);
        //            }
        //        }
        //    }
        //}
    }
}